package com.example.templateapp.ui.collasping

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.example.templateapp.R
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.snackbar.Snackbar
import com.xuexiang.xutil.tip.ToastUtils
import kotlinx.android.synthetic.main.activity_scrolling.*

class ScrollingActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_scrolling)
/*        setSupportActionBar(findViewById(R.id.toolbar))
        findViewById<CollapsingToolbarLayout>(R.id.toolbar_layout).title = ""
        findViewById<FloatingActionButton>(R.id.fab).setOnClickListener { view ->

            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                .setAction("Action", null).show()
        }*/
        layout.setOnClickListener {
            Snackbar.make(it, "Replace with your own action", Snackbar.LENGTH_LONG)
                .setAction("Action", {
                    ToastUtils.toast("toast")
                }).show()
        }

        btn.setOnClickListener {
            Snackbar.make(it, "Replace with your own action", Snackbar.LENGTH_LONG)
                .setAction("Action", null).show()
        }

        app_bar.addOnOffsetChangedListener(
            AppBarLayout.OnOffsetChangedListener
            { appBarLayout, verticalOffset ->
                tv.text = verticalOffset.toString()
            })

    }
}